function exp_syntheticdataset_SLICE()
    data=D350N100F3C3();
    exp_F3(data);
    h=figure(1);
    drawData(data);
    saveas(h,'figure_exp_D350N100F3C3_onlydata.fig');
    h=figure(2);
    drawData_D350N100F3C3(data);
    saveas(h,'figure_exp_D350N100F3C3_SLICE.fig');
    
    data=D600N200F3C4();
    exp_F3(data);
    h=figure(3);
    drawData(data);
    saveas(h,'figure_exp_D600N200F3C4_onlydata.fig');
    h=figure(4);
    drawData_D600N200F3C4(data);
    saveas(h,'figure_exp_D600N200F3C4_SLICE.fig');
    
    data=D500N200F5C2();
    exp_F5(data);
    
end

function drawData(data)
    plot3(data(:,1),data(:,2),data(:,3),'r.');
    grid on;
end

function drawData_D350N100F3C3(data)
    plot3(data(:,1),data(:,2),data(:,3),'r.');
    hold on;
    [x,y] = meshgrid(-200:400:200);
    z = 2*x+y;
    surf(x,y,z,'FaceColor','cyan','FaceAlpha',0.5);
    hold on;
    z = x*3-y*5;
    surf(x,y,z,'FaceColor','yellow','FaceAlpha',0.5);
    hold on;
    z = -4.2*x-2*y+100;
    surf(x,y,z,'FaceColor','blue','FaceAlpha',0.5);
    hold on;
    z = 0.2*x+3.3*y+10;
    surf(x,y,z,'FaceColor','green','FaceAlpha',0.5);
    hold on;
    grid on;
end

function drawData_D600N200F3C4(data)
    plot3(data(:,1),data(:,2),data(:,3),'r.');
    hold on;
    [x,y] = meshgrid(-200:400:200);
    z = -x+3*y;
    surf(x,y,z,'FaceColor','cyan','FaceAlpha',0.5);
    hold on;
    z = x*2.5-y*3;
    surf(x,y,z,'FaceColor','yellow','FaceAlpha',0.5);
    hold on;
    z = 4.2*x-2*y+200;
    surf(x,y,z,'FaceColor','blue','FaceAlpha',0.5);
    hold on;
    grid on;
end


function exp_F3(data)
    [corrplanes,sups]=SLICE2(data,1,0.000001,0.08);
    corratts={};
    for i=1:length(corrplanes)
        corratts{i}=[1,2,3];
    end
    displaycorrelations(corrplanes,sups,corratts,0.001, 'exp_SLICE.txt');
end

function exp_F5(data)
    [corrplanes,sups]=SLICE2(data,1,0.000001,0.08);
    corratts={};
    for i=1:length(corrplanes)
        corratts{i}=[1,2,3,4,5];
    end
    displaycorrelations(corrplanes,sups,corratts,0.001, 'exp_SLICE.txt');
end

function data=D350N100F3C3()
    numpoints = 100;
    noise_x=randint(1,numpoints,[-200,200]);
    noise_y=randint(1,numpoints,[-200,200]);
    noise_z=randint(1,numpoints,[-200,200]);
    
    x1=randint(1,numpoints/2,[-200,200]);
    y1=randint(1,numpoints/2,[-200,200]);
    z1=2*x1+y1; % 2x1+x2-x3=0
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=x2*3-y2*5+randn(1,numpoints); % 3x1-5x2-x3=0
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4*x3-2*y3+100+randn(1,numpoints)*4; % 4x1+2x2+x3=100
    
    x=[noise_x,x1,x2,x3];
    y=[noise_y,y1,y2,y3];
    z=[noise_z,z1,z2,z3];
    data=[ x',y',z'];
end

function data=D600N200F3C4()
    numpoints = 100;
    noise_x=randint(1,numpoints*2,[-200,200]);
    noise_y=randint(1,numpoints*2,[-200,200]);
    noise_z=randint(1,numpoints*2,[-200,200]);
    
    x1=randint(1,numpoints,[-200,200]);
    y1=randint(1,numpoints,[-200,200]);
    z1=-x1+3*y1+randn(1,numpoints); % -x1+3x2-x3=0
    
    x2=randint(1,numpoints,[-200,200]);
    y2=randint(1,numpoints,[-200,200]);
    z2=x2*2.5-y2*3+randn(1,numpoints); % 2.5x1-3x2-x3=0
    
    x3=randint(1,numpoints,[-200,200]);
    y3=randint(1,numpoints,[-200,200]);
    z3=-4.2*x3-2*y3+200+randn(1,numpoints); % 4.2x1+2x2+x3=200
    
    x4=randint(1,numpoints,[-200,200]);
    y4=randint(1,numpoints,[-200,200]);
    z4=0.2*x4+3.3*y4+10+randn(1,numpoints); % 0.2x1+3.3x2-x3=-10
  
    x=[x1,x2,x3,x4,noise_x];
    y=[y1,y2,y3,y4,noise_y];
    z=[z1,z2,z3,z4,noise_z];
    data=[ x',y',z'];
end

function data=D500N200F5C2()
    numpoints = 100;
    noise_x=randint(1,numpoints*2,[-200,200]);
    noise_y=randint(1,numpoints*2,[-200,200]);
    noise_z=randint(1,numpoints*2,[-200,200]);
    noise_r=randint(1,numpoints*2,[-200,200]);
    noise_t=randint(1,numpoints*2,[-200,200]);
    
    x1=randint(1,numpoints*1.5,[-200,200]);
    y1=randint(1,numpoints*1.5,[-200,200]);
    z1=randint(1,numpoints*1.5,[-200,200]);
    r1=randint(1,numpoints*1.5,[-200,200]);
    t1=-x1+3*y1+2*z1-0.2*r1+randn(1,numpoints*1.5); % -x1+3x2+2x3-0.2x4-x5=0
    
    x2=randint(1,numpoints*1.5,[-200,200]);
    y2=randint(1,numpoints*1.5,[-200,200]);
    z2=randint(1,numpoints*1.5,[-200,200]);
    r2=randint(1,numpoints*1.5,[-200,200]);
    t2=3*x2-y2-z2-5.5*r2+400+randn(1,numpoints*1.5); % -3x1+x2+x3+5.5x4+x5=400
  
    x=[x1,x2,noise_x];
    y=[y1,y2,noise_y];
    z=[z1,z2,noise_z];
    r=[r1,r2,noise_r];
    t=[t1,t2,noise_t];
    data=[ x',y',z',r',t'];
end

